package com.hexiang.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hexiang.dao.CityDao;
import com.hexiang.domain.City;
import com.hexiang.service.CityService;

/**
 * 城市业务逻辑实现类
 */
@Service
public class CityServiceImpl implements CityService {

    @Autowired
    private CityDao cityDao;

    @Override
    public City findCityByName(String cityName) {
        return cityDao.findByName(cityName);
    }

    @Override
    public int saveCity(City city) {
        return cityDao.saveCity(city);
    }

    @Override
    public int updateCity(City city) {
        return cityDao.updateCity(city);
    }

    @Override
    public int deleteCity(Long id) {
        return cityDao.deleteCity(id);
    }

    @Override
    public List<City> findAllCity() {
        return cityDao.findAllCity();
    }

    @Override
    public PageInfo findCityPage(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        return new PageInfo(cityDao.findAllCity());
    }

}
